#include <stdio.h>

unsigned char SpiReverseBitOrder(unsigned short va)
{
  /*4005fc:	d10083ff 	sub	sp, sp, #0x20
  400600:	79001fe0 	strh	w0, [sp, #14]	// [sp+14] = va&0xff
  400604:	79401fe0 	ldrh	w0, [sp, #14]	// w0 = va
  400608:	53196000 	lsl	w0, w0, #7			// w0 = va<<7
  40060c:	13001c01 	sxtb	w1, w0			// w1 = va<<7
  400610:	79401fe0 	ldrh	w0, [sp, #14]	// w0 = va
  400614:	531b6800 	lsl	w0, w0, #5			// w0 = va<<5
  400618:	13001c00 	sxtb	w0, w0			// w0 = w0
  40061c:	121a0000 	and	w0, w0, #0x40		// w0 = (va<<5)&0x40
  400620:	13001c00 	sxtb	w0, w0
  400624:	2a000020 	orr	w0, w1, w0			// w0 = (va<<7)|((va<<5)&0x40)
  400628:	13001c01 	sxtb	w1, w0			// w1 = (va<<7)|((va<<5)&0x40)
  40062c:	79401fe0 	ldrh	w0, [sp, #14]	// w0 = va
  400630:	531d7000 	lsl	w0, w0, #3			// w0 = va<<3
  400634:	13001c00 	sxtb	w0, w0			
  400638:	121b0000 	and	w0, w0, #0x20		// w0 = (va<<3)&0x20
  40063c:	13001c00 	sxtb	w0, w0
  400640:	2a000020 	orr	w0, w1, w0			// w0 = (va<<7)|((va<<5)&0x40)|((va<<3)&0x20)
  400644:	13001c01 	sxtb	w1, w0
  400648:	79401fe0 	ldrh	w0, [sp, #14]
  40064c:	531f7800 	lsl	w0, w0, #1
  400650:	13001c00 	sxtb	w0, w0
  400654:	121c0000 	and	w0, w0, #0x10
  400658:	13001c00 	sxtb	w0, w0
  40065c:	2a000020 	orr	w0, w1, w0			// w0 = (va<<7)|((va<<5)&0x40)|((va<<3)&0x20)|((va<<1)&0x10)
  400660:	13001c01 	sxtb	w1, w0
  400664:	79401fe0 	ldrh	w0, [sp, #14]
  400668:	13017c00 	asr	w0, w0, #1
  40066c:	13001c00 	sxtb	w0, w0
  400670:	121d0000 	and	w0, w0, #0x8
  400674:	13001c00 	sxtb	w0, w0
  400678:	2a000020 	orr	w0, w1, w0			// w0 = (va<<7)|((va<<5)&0x40)|((va<<3)&0x20)|((va<<1)&0x10)|((va>>1)&0x8)
  40067c:	13001c01 	sxtb	w1, w0
  400680:	79401fe0 	ldrh	w0, [sp, #14]
  400684:	13037c00 	asr	w0, w0, #3
  400688:	13001c00 	sxtb	w0, w0
  40068c:	121e0000 	and	w0, w0, #0x4
  400690:	13001c00 	sxtb	w0, w0
  400694:	2a000020 	orr	w0, w1, w0		// w0 = (va<<7)|((va<<5)&0x40)|((va<<3)&0x20)|((va<<1)&0x10)|((va>>1)&0x8)|((va>>3)&0x4)
  400698:	13001c01 	sxtb	w1, w0
  40069c:	79401fe0 	ldrh	w0, [sp, #14]
  4006a0:	13057c00 	asr	w0, w0, #5
  4006a4:	13001c00 	sxtb	w0, w0
  4006a8:	121f0000 	and	w0, w0, #0x2
  4006ac:	13001c00 	sxtb	w0, w0
  4006b0:	2a000020 	orr	w0, w1, w0		// w0 = (va<<7)|((va<<5)&0x40)|((va<<3)&0x20)|((va<<1)&0x10)|((va>>1)&0x8)|((va>>3)&0x4)|((va>>5)&0x2)
  4006b4:	13001c01 	sxtb	w1, w0
  4006b8:	79401fe0 	ldrh	w0, [sp, #14]
  4006bc:	13077c00 	asr	w0, w0, #7
  4006c0:	13001c00 	sxtb	w0, w0
  4006c4:	12000000 	and	w0, w0, #0x1
  4006c8:	13001c00 	sxtb	w0, w0
  4006cc:	2a000020 	orr	w0, w1, w0 */	// w0 = (va<<7)|((va<<5)&0x40)|((va<<3)&0x20)|((va<<1)&0x10)|((va>>1)&0x8)|((va>>3)&0x4)|((va>>5)&0x2)|((va>>7)&0x1)
  unsigned char vb = (va << 7) | ((va<<0x5) & 0x40) | ((va<<3) & 0x20) | ((va<<1)&0x10) |
		 ((va>>1)&0x8) | ((va>>3)&0x4) | ((va>>5)&0x2) | ((va>>7)&0x1);

  /*4006d0:	13001c00 	sxtb	w0, w0
  4006d4:	39007fe0 	strb	w0, [sp, #31]
  4006d8:	39407fe0 	ldrb	w0, [sp, #31]
  4006dc:	910083ff 	add	sp, sp, #0x20
  4006e0:	d65f03c0 	ret */
  return vb;
}

int main(int argc, char **arv)
{
  /*4006e4:	a9bd7bfd 	stp	x29, x30, [sp, #-48]!
  4006e8:	910003fd 	mov	x29, sp
  4006ec:	b9001fa0 	str	w0, [x29, #28]
  4006f0:	f9000ba1 	str	x1, [x29, #16]
  4006f4:	52800680 	mov	w0, #0x34                  	// #52
  4006f8:	97ffffc1 	bl	4005fc <SpiReverseBitOrder>*/
	int a = SpiReverseBitOrder(0x34);

  /*4006fc:	12001c00 	and	w0, w0, #0xff
  400700:	b9002fa0 	str	w0, [x29, #44]
  400704:	90000000 	adrp	x0, 400000 <_init-0x480>
  400708:	911f6000 	add	x0, x0, #0x7d8
  40070c:	b9402fa2 	ldr	w2, [x29, #44]
  400710:	528002e1 	mov	w1, #0x17                  	// #23
  400714:	97ffff77 	bl	4004f0 <printf@plt> */
	printf("%d = 0x%02x\n", 0x17, a);

  /*400718:	d503201f 	nop
  40071c:	a8c37bfd 	ldp	x29, x30, [sp], #48
  400720:	d65f03c0 	ret
  400724:	00000000 	.inst	0x00000000 ; undefined*/
	return 0;
}
